import { QL } from 'iflux2'
import { Map } from 'immutable'
export const sort = { "register": 0,"login": 1, "order": 2};
export const rewardRulesQL = QL('rewardRulesQL', [
    'rewardRules',
    (rewardRules) => rewardRules.map(r =>
        r.set('sortNum', sort[(r.get('obtainType'))]) // 人工置入展示排序
    )
]);


export const orderObtainQL = QL('orderObtainQL',[
    rewardRulesQL,
    (rewardRules) => {
        if(rewardRules){
            return rewardRules.find(r => r.get("obtainType") == "order") || Map({})
        }
        return Map({})
    }
])